<template>
  <div class="interview">
    <!-- 标题 -->
    <van-nav-bar
      right-text="答题卡"
      left-arrow
      @click-left="$router.back()"
      @click-right="onClickRight"
    >
      <template #title>
        <div>面试题<span>74</span></div>
      </template>
    </van-nav-bar>
    <!-- 题目区域 -->
    <div class="topic">
      <div style="margin-bottom: 10px;">
        【单选】设定量a是整型，f是实型，i是双精度型，则表达式10+'a'+i*f值的数据类型为()
      </div>
      <span style="padding: 3px;background-color: #ccc;font-size: 12px;"
        >C/C++</span
      >
    </div>
    <!-- 答案选项 -->
    <div class="option">
      <div class="answersList">
        <div class="options">A.</div>
        <div class="answer">int</div>
        <van-icon name="cross" /><van-icon name="success" />
      </div>
      <div class="answersList">
        <div class="options">B.</div>
        <div class="answer">int</div>
        <van-icon name="cross" /><van-icon name="success" />
      </div>
      <div class="answersList">
        <div class="options">C.</div>
        <div class="answer">int</div>
        <van-icon name="cross" /><van-icon name="success" />
      </div>
      <div class="answersList">
        <div class="options">D.</div>
        <div class="answer">int</div>
        <van-icon name="cross" /><van-icon name="success" />
      </div>
    </div>
    <!-- 答案解析组件 -->
    <analysis class="analysis"></analysis>
    <!-- 底部功能栏组件 -->
    <feature></feature>
    <!-- 答题卡组件 -->
    <answerSheet ref="answerSheetShow"></answerSheet>
    <!-- 意见反馈组件 -->
    <feedback></feedback>
  </div>
</template>

<script>
import { interviewQuestions } from '../../api/api'

export default {
  // 异步导入组件并且注册组件
  components: {
    analysis: () => import('./component/analysis'), // 答案解析组件
    feature: () => import('./component/feature'), // 底部功能栏组件
    answerSheet: () => import('./component/answerSheet'), // 答题卡组件
    feedback: () => import('./component/feedback') // 意见反馈组件9
  },
  data () {
    return {}
  },
  async mounted () {
    const res = await interviewQuestions(this.$route.params.id)
    console.log(res)
  },
  methods: {
    // 答题卡按钮
    onClickRight () {
      this.$refs.answerSheetShow.answerSheetShow = true
    }
  }
}
</script>

<style lang="less" scoped>
.interview {
  padding: 0 10px;
  .topic {
    font-size: 16px;
    margin: 20px 0;
  }
  .option {
    font-size: 16px;
    .answersList {
      display: flex;
      padding: 15px;
      margin-bottom: 15px;
      border: #ccc solid 1px;
      .options {
        margin-right: 10px;
      }
      .answer {
        flex: 1;
      }
    }
  }
  .analysis {
    margin-top: 50px;
    display: none;
  }
}
</style>
